package demo03;

/**
 * @author JYH
 * @version 1.0
 * @date 2022/10/27 9:39
 */
public class Test {
    public static void main(String[] args) throws Exception{

        //1.
        Class<Mouse> mouseClass = Mouse.class;
        //2.
        Mouse mouse = new Mouse();
        Class aClass = mouse.getClass();
        //3.
        Class<?> aClass1 = Class.forName("demo03.Mouse");

        System.out.println(mouseClass==aClass);
        System.out.println(mouseClass==aClass1);
        System.out.println(aClass==aClass1);


        Mouse mouse1 = mouseClass.newInstance();
        Mouse mouse2 = mouseClass.newInstance();
        System.out.println(mouse1==mouse2);
    }

}
class Mouse{
    private double price;
    private int size;

    public void use(){
        System.out.println("这是use方法");
    }
}